<template>
    <div id="cx">
        <div>
            <el-input
                    type="textarea"
                    :rows="2"
                    placeholder="请输入内容"
                    v-model="textarea">
            </el-input>
            <el-button type="info" piain @click="handleClick">一键编码</el-button>
        </div>
        <div>
            <el-input
                    type="textarea"
                    :rows="2"
                    placeholder="请输入内容"
                    v-model="textarea2">
            </el-input>
            <el-button type="info" piain @click="handleClick2">一键还原</el-button>
        </div>
    </div>

</template>

<script>
    export default {
        name:"Base64",
        data:function(){
            return {
                textarea: '',
                textarea2:''
            }
        },
        methods:{

            handleClick:function () {
                let cx = this.textarea;
                console.log(cx);
                let Base64 = require('js-base64').Base64;
                this.textarea2 = Base64.encode(cx);
                console.log(this.textarea2)
            },handleClick2:function () {
                let cx = this.textarea2;
                let Base64 = require('js-base64').Base64;
                this.textarea = Base64.decode(cx);
                console.log(this.textarea)
            },
        }
    }
</script>

<style scoped>

</style>
